package com.thon.entity.user;

import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.springframework.format.annotation.DateTimeFormat;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.thon.entity.util.IdEntity;

@Entity
@Table(name = "charitarians")
@JsonIgnoreProperties(ignoreUnknown=true)
public class Charitarian extends IdEntity{

	private static final long serialVersionUID = -1710139285200070822L;

	private String nickName;
	private String realName;
	private String hometown;
	private String phone;
	private String email;
	private String sinaWeibo;
	private String tencentWeibo;
	private User user;
	private Byte status;
	private Date createdDate;
	
	public String getNickName() {
		return nickName;
	}
	public void setNickName(String nickName) {
		this.nickName = nickName;
	}
	public String getRealName() {
		return realName;
	}
	public void setRealName(String realName) {
		this.realName = realName;
	}
	public String getHometown() {
		return hometown;
	}
	public void setHometown(String hometown) {
		this.hometown = hometown;
	}
	public String getPhone() {
		return phone;
	}
	public void setPhone(String phone) {
		this.phone = phone;
	}
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public String getSinaWeibo() {
		return sinaWeibo;
	}
	public void setSinaWeibo(String sinaWeibo) {
		this.sinaWeibo = sinaWeibo;
	}
	public String getTencentWeibo() {
		return tencentWeibo;
	}
	public void setTencentWeibo(String tencentWeibo) {
		this.tencentWeibo = tencentWeibo;
	}
	
	@OneToOne(cascade = CascadeType.MERGE)
	@JoinColumn(name = "user_id", nullable = false)
	@JsonIgnoreProperties(value = { "hibernateLazyInitializer", "handler" })
	public User getUser() {
		return user;
	}
	public void setUser(User user) {
		this.user = user;
	}
	public Byte getStatus() {
		return status;
	}
	public void setStatus(Byte status) {
		this.status = status;
	}
	
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
	public Date getCreatedDate() {
		return this.createdDate;
	}

	public void setCreatedDate(Date createdDate) {
		this.createdDate = createdDate;
	}
}
